<template>
  <div class="login-wrap">
    <div class="form-wrap" v-show="true">
      <el-form ref="form" :model="params" :rules="rules">
        <el-form-item prop="mobile">
          <el-input v-model="params.mobile" placeholder="手机号码"></el-input>
        </el-form-item>
        <el-form-item prop="email">
          <el-input v-model="params.email" type="email" placeholder="邮箱"></el-input>
        </el-form-item>
        <el-form-item prop="password">
          <el-input v-model="params.password" type="password" placeholder="密码"></el-input>
        </el-form-item>
        <el-form-item prop="password2">
          <el-input v-model="params.password2" type="password" placeholder="请确认密码"></el-input>
        </el-form-item>
        <el-form-item class="text-center">
          <a href="register.vue"><el-button class="btn" type="primary" round @click="zhuce">注册</el-button></a>
          <el-button class="btn" type="primary" round @click="submit">已有账号</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
  export default ({
    data () {
      return {
        a: null,
        params: {},
        rules: {
          name: [
            {required: true, message: '请输入账号', trigger: 'change'}
          ],
          password: [
            {required: true, message: '请输入密码', trigger: 'change'},
            {min: 6, message: '密码长度不正确', trigger: 'change'}
          ]
        }
      }
    },
    methods: {

      submit() {
        this.$refs['form'].validate((valid) => {
          if (valid) {
            // alert('submit!')
            this.$router.replace('index')
          } else {
            console.log('error submit!!')
          }
        })
      },
    }
  })
</script>


<style lang='scss' scoped>
  .login-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-width: 1000px;
    align-items: stretch;
    background: url("~/static/images/login_2bg.png");
    background-size: cover;
    -webkit-background-size: cover;
    -o-background-size: cover;
    background-position: center 0;
    display: flex;
    align-items: center;
    justify-content: center;
    > div {
      width: 400px;
      background: $light;
      padding: 30px 20px 0;
      border-radius: 10px;
      overflow: hidden;
      margin-top: -120px;
      .btn {
        padding-left: 50px;
        padding-right: 50px;
      }
    }
  }
</style>
